package com.okaixz.client.controller;


import com.okaixz.client.model.domain.PwdTagInfo;
import com.okaixz.client.service.IPwdInfoService;
import com.okaixz.client.service.IPwdTagInfoService;
import com.okaixz.common.annotation.Log;
import com.okaixz.common.client.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cdz
 * @since 2025-09-17
 */
@RestController
@RequestMapping("/kb/pwd/tag")
public class PwdTagInfoController {

    @Autowired
    private IPwdTagInfoService pwdTagInfoService;
    @RequestMapping("/add")
    public Result<PwdTagInfo> addOrUpdate(String name,int type){
        PwdTagInfo pwdTagInfo=pwdTagInfoService.addOrUpdate(name, type);
        return Result.success(pwdTagInfo);
    }
    @RequestMapping("/delete")
    public Result<Boolean> deleteOne(@RequestBody PwdTagInfo pwdTagInfo){
        Boolean result=pwdTagInfoService.deleteTag(pwdTagInfo);
        return Result.success(result);
    }
    @RequestMapping("/uploadAll")
    public Result<List<PwdTagInfo>> uploadAll(@RequestBody List<PwdTagInfo> pwdTagInfoList){
        List<PwdTagInfo> result=pwdTagInfoService.uploadAll(pwdTagInfoList);
        return Result.success(result);
    }


}
